/**
 * 
 */
package com.wbcs.jbsf.util;

import com.wbcs.jbsf.modal.abs.AbsTableModal;

/**
 * JBSF常量工具类
 * @author hawkfly
 */
public class Consts
{
    public static final String REQUEST_USERNAME = "username";
    public static final String REQUEST_PASSWORD = "password";
    public static final String SQL_LOGIN = "select ID userid, username usercode from t_user_info where username=? and password=?";
    public static final String REQUEST_ADMINROLES = "adminroles";
    public static final String REQUEST_ROLECODES = "rolecodes";
    
    public static final String SESSION_USERCODE = "usercode";
    public static final String SESSION_USERID = "userid";
    public static final String SESSION_USERNAME= "realname";
    public static final String SESSION_SITEID = "siteids";
    public static final String SESSION_SITENAME = "sitename";
    public static final String SESSION_LMIDS = "sectionids";
    public static final String SESSION_ROLE = "roles";
    public static final String SESSION_HTTPAUTHES = "httpauthes";
    public static final String SESSION_WBCSAUTHES = "wbcsauthes";
    public static final String SESSION_HTTPMENUS = "httpmenus";
    public static final String SESSION_WBCSMENUS = "wbcsmenus";
    public static final String SESSION_ISADMIN = "isadmin";
    public static final String SESSION_YEAR = "year";
    public static final String SESSION_MONTH = "month";
    public static final String SESSION_LOGINTIME = "logintime";
    public static final String SESSION_ORGID = "orgid";
    
    public static final String ES_PAGEID = "PAGEID{";
    
    public static final String CONTINUE = "continue";
    public static final String WBCSAUTHS = "wbcsauths";
    public static final String JEEAUTHS = "j2eeauths";
    public static final String DB_YES = "1";
    public static final String ADMINAUTHES = "adminauthes";
    
    public static final String FLOW_DRAFT = "0";
    public static final String FLOW_CHECK = "1";
    public static final String FLOW_PUBLISH = "2";
    public static final String FLOW_GOBACK = "3";
    
    public static final String AUTH_COL = "col";
    
    public static final String MAINSITE = "1";
    
    public enum LoginPage{
        siteloginpage, backpfloginpage;
    }
    
    public enum AccessTypeConst{
        nonread, readonly, write, readwrite;
    }
    
    public enum PageMenusPackagingConst{
        jcollection, json, xml;
    }
    
    public enum Location{
        top, bottom, left, right;
    }
    
    public enum AuthType{
        concept, page, panel, report;
    }
    
    public static enum RoleTypes{
        superadmin, admin, user;
    }
    
    public static class AdminAuth{ 
        private static AbsTableModal adminauthestm;
        static{
            adminauthestm = new AbsTableModal(ADMINAUTHES,"CODE"){};
            adminauthestm.newRow().addCol("ID","-1")//权限管理
                                  .addCol("CODE","authoritymngPage")
                                  .addCol("NAME","权限管理")
                                  .addCol("ICON","")
                                  .addCol("PID",null)
                                  .addCol("TYPE",AuthType.page.toString())
                                  .addCol("TARGET","")
                                  .addCol("ORDERNUM","1")
                                  .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                  .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-2")//权限编辑
                                 .addCol("CODE","authoritydetailPage")
                                 .addCol("NAME","权限编辑")
                                 .addCol("ICON","")
                                 .addCol("PID","-1")
                                 .addCol("TYPE",AuthType.page.toString())
                                 .addCol("TARGET","")
                                 .addCol("ORDERNUM","1")
                                 .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                 .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-3")//角色管理
                                .addCol("CODE","rolemngPage")
                                .addCol("NAME","角色管理")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-4")//赋权列表
                                .addCol("CODE","authoritiesPopupPage")
                                .addCol("NAME","赋权列表")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-5")//赋权给角色
                                .addCol("CODE","auths2rolePage")
                                .addCol("NAME","赋权给角色")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-6")//菜单列表
                                .addCol("CODE","menusPopupPage")
                                .addCol("NAME","菜单列表")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-7")//菜单给页面
                                .addCol("CODE","menu2pagePage")
                                .addCol("NAME","菜单给页面")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-8")//方位管理
                                .addCol("CODE","locationTypePage")
                                .addCol("NAME","方位管理")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-9")//用户列表 
                                .addCol("CODE","roles2userPage")
                                .addCol("NAME","用户列表 ")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            
            adminauthestm.newRow().addCol("ID","-10")//角色给用户
                                .addCol("CODE","roleselectPage")
                                .addCol("NAME","角色给用户 ")
                                .addCol("ICON","")
                                .addCol("PID","-1")
                                .addCol("TYPE",AuthType.page.toString())
                                .addCol("TARGET","")
                                .addCol("ORDERNUM","1")
                                .addCol("ACCESSTYPE",AccessTypeConst.readwrite.toString())
                                .addCol("DISPLAY","1");
            //正常情况下扫描report_sys_authority.xml文件中的所有page来初始化后台配置权限相关的页面
        }
        public static AbsTableModal getAdminauthes(){
            return adminauthestm;
        }
    }
}

